// app/(dashboard)/users/page.tsx - 需要拦截的页面
'use client';
import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import { Table, Button, Space } from 'antd';
import { EditOutlined } from '@ant-design/icons';

export default function Profile() {
    const router = useRouter();

    const goToEdit = (id: number) => {
        // 跳转到悬浮面板路由
        router.push(`/profile?modal=edit-user&id=${id}`);

    };

    return (
        <div>
            <h1>用户管理</h1>
            <Table
                rowKey="id" // 👈 加上这个，告诉 Table 用 id 做 key
                dataSource={[{ id: 1, name: '张三', email: 'zhangsan@example.com' }]}
                columns={[
                    { title: 'ID', dataIndex: 'id' },
                    { title: '姓名', dataIndex: 'name' },
                    { title: '邮箱', dataIndex: 'email' },
                    {
                        title: '操作',
                        render: (_, record) => (
                            <Space>
                                <Button
                                    icon={<EditOutlined />}
                                    onClick={() => goToEdit(record.id)}
                                >
                                    编辑
                                </Button>
                            </Space>
                        )
                    }
                ]}

            />
        </div>
    );
}